package com.open.source.javassist;

import javassist.Modifier;

/**
 * @author ZonLen since on 2022/3/24 下午5:22
 */
public enum ModifierAccess {

  PRIVATE(Modifier.PRIVATE),

  PROTECTED(Modifier.PROTECTED),

  PUBLIC(Modifier.PUBLIC),
  ;

  private final int modifierAccess;

  ModifierAccess(int modifierAccess) {
    this.modifierAccess = modifierAccess;
  }

  public int modifierAccess() {
    return modifierAccess;
  }

  public static ModifierAccess convert(int modifierAccess) {
    for (ModifierAccess access : ModifierAccess.values()) {
      if (access.modifierAccess == modifierAccess) {
        return access;
      }
    }
    throw new RuntimeException("modifier not exist, please check");
  }
}
